package org.mspring.mlog.duoshuo.sync;

/**
 * @author GaoYoubo
 * @since 2015/2/18
 */
public enum SyncAction {
    CREATE("create"), APPROVE("approve"), SPAM("spam"), DELETE("delete"), DELETE_FOREVER("delete-forever");

    private final String value;

    SyncAction(String value) {
        this.value = value;
    }

    public static SyncAction newInstance(String value) {
        switch (value) {
            case "create":
                return CREATE;
            case "approve":
                return APPROVE;
            case "spam":
                return SPAM;
            case "delete":
                return DELETE;
            case "delete-forever":
                return DELETE_FOREVER;
            default:
                throw new NullPointerException("未知的动作:" + value);
        }
    }

    public String getValue() {
        return value;
    }
}
